import os

from flask import Flask
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)

# 连接远程 MySQL数据库
username = 'group6'
password = 'group6'
host = '10.10.18.64'
port = '3306'
database = 'flask_oa'
# app.config['SQLALCHEMY_DATABASE_URI'] = f'mysql+pymysql://{username}:{password}@{host}:{port}/{database}'


# 连接 SQLite数据库
BASE_DIR = os.path.join(
    os.path.dirname(os.path.abspath(__file__)),
    'db.sqlite'
)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + BASE_DIR
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True

db = SQLAlchemy(app)
